﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Kugar.Core.ExtMethod
{
    public static class NumberUpDownExMethod
    {
        public static bool SafeSetValue(this System.Windows.Forms.NumericUpDown nud, decimal value)
        {
            bool ret = true;

            if (value > nud.Maximum)
            {
                value = nud.Maximum;
                ret = false;
            }
            if (value < nud.Minimum)
            {
                value = nud.Minimum;
                ret = false;
            }

            nud.Value = value;

            return ret;
        }
    }
}
